package com.fresh.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.fresh.entity.ProIn;
import com.fresh.entity.ProInQO;
import com.fresh.mapper.ChengPinMapper;
import com.fresh.service.ChengPinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChengPinServiceImpl implements ChengPinService {
    @Autowired
    ChengPinMapper chengPinMapper;

    @Override
    public PageInfo<ProIn> findPageInfoByCondition(ProInQO proInQO, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<ProIn> proIns = chengPinMapper.findPageInfoByCondition(proInQO);
        PageInfo<ProIn> pageInfo = new PageInfo<>(proIns);
        return pageInfo;
    }

    @Override
    public void add(ProIn proIn) {
        chengPinMapper.insert(proIn);
    }

    @Override
    public void update(ProIn proIn) {
        chengPinMapper.update(proIn);
    }
    @Override
    public void updatePro(ProIn proIn) {
        chengPinMapper.updatePro(proIn);
    }

}
